package com.sxt.springsecuritytest2.exception; /*
 *
 * @Description todo
 * @author qqg
 * @date $date$
 * @param $params$
 * @return $return$
 **/

import org.springframework.security.access.AccessDeniedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class HandleControllerException {

    @ExceptionHandler(RuntimeException.class)
            public String ExceptionHandler(RuntimeException e){
                if (e instanceof AccessDeniedException){
                    return "redirect:/403.html";
        }
        return "redirect:/500.html";
    }
}
